Skip to content

Fix malformed fallback streaming URL #534

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

PattaFeuFeu
Copy link
Owner

@PattaFeuFeu PattaFeuFeu commented Mar 13, 2025

Description

A user of the library mentioned in #530 that the streaming fallback URL is malformed in that it doesn’t contain ://, e.g. httpsmastodon.social instead of https://mastodon.social.

This PR ensures that the URL follows URL specifications by using HttpUrl to create a URL.
To not always run the builder, I’ve put it into a lambda that is only called if the fallback URL is actually necessary.

An easier way would be to just write $scheme://$instanceName but I decided against it so that OKHTTP HttpUrl is used on both ends, ensuring compatibility.

Closes #530

Type of Change

  • Bug fix

Breaking Changes

  • None

How Has This Been Tested?

I’ve added three new unit tests to test the main success case and the two fallback cases.

Mandatory Checklist

  • I ran gradle check and there were no errors reported
  • I have performed a self-review of my code
  • I have added tests that prove my fix is effective or that my feature works
  • All tests pass locally with my changes
  • I have added KDoc documentation to all public methods

@PattaFeuFeu PattaFeuFeu self-assigned this Mar 13, 2025
@PattaFeuFeu PattaFeuFeu force-pushed the bugfix/#530/fallback-url-streaming-api-missing-colon-dash branch from 45eac7f to 041f938 Compare March 13, 2025 17:31
@PattaFeuFeu PattaFeuFeu force-pushed the bugfix/#530/fallback-url-streaming-api-missing-colon-dash branch 2 times, most recently from d403e08 to 5699d3e Compare March 23, 2025 14:58
@PattaFeuFeu PattaFeuFeu requested a review from bocops March 23, 2025 14:58
@PattaFeuFeu PattaFeuFeu force-pushed the bugfix/#530/fallback-url-streaming-api-missing-colon-dash branch from 5699d3e to 7ad00bc Compare March 23, 2025 15:19
Copy link
Collaborator

@bocops bocops left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@PattaFeuFeu PattaFeuFeu merged commit 645c384 into master Mar 24, 2025
5 checks passed
@PattaFeuFeu PattaFeuFeu deleted the bugfix/#530/fallback-url-streaming-api-missing-colon-dash branch March 24, 2025 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fallback URL for streaming API seems malformed
2 participants